namespace RunGun
{
    /// <summary>
    /// Generic class to create singleton objects.
    /// </summary>
    /// <typeparam name="T">The type to create the singleton of.</typeparam>
    public class Singleton<T> where T: class, new()
    {
        /// <summary>
        /// The singleton instance object
        /// </summary>
        private static readonly T SingInstance = new T();

        /// <summary>
        /// Prevents a default instance of the <see cref="Singleton{T}" /> class from being created.
        /// </summary>
        private Singleton()
        {
        }

        /// <summary>
        /// Gets the singleton instance of this object.
        /// </summary>
        public static T Instance { get { return SingInstance; } }
    }
}